#include <iostream>
#include <vector>

using namespace std;


typedef void (*fun_t)();//函数指针

void PrintfLog()
{
    cout<<"pid:"<<getpid()<<"，正在打印日志任务"<<endl;

}

void InsertMySQL()
{
    cout<<"正在执行数据库任务"<<endl;

}
void NetRequest()
{
    cout<<"正在网络请求任务任务"<<endl;

}

#define COMMAND_LOG 0
#define COMMAND_MYSQL 1
#define COMMAND_NETREQUEST 2

class Task{

public:
    Task()
    {
        funcs.push_back(PrintfLog);
        funcs.push_back(InsertMySQL);
        funcs.push_back(NetRequest);

    }

    void Execute(int command)
    {
        if(command >= 0 && command < funcs.size())
        funcs[command]();
    }

    ~Task()
    {
        
    }
public:
    vector<fun_t> funcs;
};
